<?php
    $Queue_Driver           = 'Mysql';
    $Queue_DriverArgs       = [
        'pdo'    => [
            'dsn'       =>'mysql:host=192.168.1.115;dbname=lactone?charset=utf8',
            'username'  =>'root',
            'password'  =>'',
            'options'   =>[
                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
            ]
        ],
    ];

   $Server_ip = '127.0.0.1';
   $Server_port = '2222';

return [
    'Spider\network\SpiderToServer'=>[
        'ip'    => $Server_ip, //服务端地址
        'port'  => $Server_port       //服务端端口
    ],
    'Spider\network\SendTaskToServer'=>[
        'ip'    => $Server_ip, //服务端地址
        'port'  => $Server_port      //服务端端口
    ],
    'Spider\network\SendTaskResultToServer'=>[
        'ip'    => $Server_ip, //服务端地址
        'port'  => $Server_port      //服务端端口
    ],
    'Spider\network\Server'=>[  //本地监听端口配置
        'ip'    => '0.0.0.0',
        'port'  => '2223',
        'Config'=>[
            'worker_num' => 4,
            'daemonize' => false,
            'max_request' => 10000,
            'dispatch_mode' => 3,
            'task_worker_num' => 30
        ]
    ],
   'TaskQueue' =>[      // 任务发送队列
       'Driver'     => $Queue_Driver,
       'DriverArgs' => array_merge($Queue_DriverArgs,['key'=>'taskQueue']),
   ],
   'taskCompleteQueue' =>[  //任务完成队列
       'Driver'     =>$Queue_Driver,
       'DriverArgs' => array_merge($Queue_DriverArgs,['key'=>'taskCompleteQueue']),
   ],
   'log'       =>[  //日志配置
       'handler'=>'file',
       'name'   =>__DIR__.'/../log',
       'conf'   =>[
           'timeFormat' =>'%m %d %H:%M:%S'
       ],
       'dir'   =>__DIR__.'/../',
       'level' => 5 //error 0,run 1,debug 2,info 3
   ],
   'cache'  =>[
       'dir'   => __DIR__."/../Data/cache/",
   ],
   'run'       =>[
       'initClass' =>[
            'Spider\network\SpiderToServer',
            'Spider\network\SendTaskResultToServer',
            'Spider\network\SendTaskToServer',
            'Spider\network\Server',
        ]
    ],
    'Spider\Site\zhihu_com' =>[
        'pdo'   =>[
            'dsn'       =>'mysql:host=192.168.1.115;dbname=lactone?charset=utf8',
            'username'  =>'root',
            'password'  =>'',
            'options'   =>[
                PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
            ]
        ]
    ]
];